Repository navigation
perf(app-shell): a cold Console load asks the app bundle the moment the app list answers - #38252
Conversation
Claude-Session: https://claude.ai/code/session_017xRBcWDb7S8Z7oRDGzvfT2 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xRBcWDb7S8Z7oRDGzvfT2 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xRBcWDb7S8Z7oRDGzvfT2 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xRBcWDb7S8Z7oRDGzvfT2 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xRBcWDb7S8Z7oRDGzvfT2 Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8 L1: ACCEPT · head Seat checks
Landing: non-governed, ≤3000 lines. The seat lands it through the ordinary queue. |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 46139727451 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
Fixes #38170
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
On an app route the console root (
useAppObjectScopePrefetch) entered the app's metadata bundle from an effect of the render that names the app. On a cold load the app list is still on the wire when that hook mounts, so a full tree re-render (and the effects after it) sat between theGET /api/v1/meta/appanswer andGET /api/v1/meta/app/NAME/bundle. The hook now also asks for the bundle in the app list's own answer: it joins the provider's eager app-list read (ensureType('app')never asks again), resolves the route segment against that list exactly as the render does (matchAppBySegment: package id first, then name), and enters that app through the same adapter. The render-time effect sees that this visit already entered the app and does not ask again; any other visit (another app, a return after leaving, an app list already in hand) enters as before.Only WHEN changes. The request, its adapter and session, the app it names and the number of requests are the same:
loadAppBundle(pinned:thisis the adapter).AppContent, which draws the refusal, is untouched./auth/me/permissions(the hook sits above the permission scope by design), and the bundle answer is filtered by the server's own checks.AppContent's entry, below the permission read, is unchanged.Why
The card's suggested direction was to start the bundle "as soon as the route names the app". On current main the route cannot name the bundle on its own: the
/apps/SEGMENTsegment is the package id (ADR-0048) or the app name, the bundle route is keyed by the app name, a package may ship several apps, and only the app list says whether this user may see the app. Asking by segment would fetch a wrong or refused bundle on most canonical URLs and add a request for apps the user cannot see, so the earliest point that keeps the invariants is the app list's answer. That is what this change does.Tests
describein the shared harnessappObjectScope-12811.test.tsx(5 tests): the ordering pin (the bundle request lands after the app list answers and before the render that names the app), bundle named by app not by segment through the same adapter, the hidden-app control, the leave-before-answer control, and the list-in-hand control (entered once, from the render).scripts/ablation-replace.mjs,git diff HEADempty after restore):expected 4 to be less than 3: the bundle comes afterrender:named), the four controls stay green.expected [ 'bundle:crm', 'bundle:crm' ] to deeply equal [ 'bundle:crm' ]).useAppObjectScopePrefetch,enterAppBundle,loadAppBundle,ConsoleShell,ConnectedShell, including the App-level boot-wave and boot-reads-once pins): 42 files, 334 tests passed. The full app-shell package (2445 test files) was not run locally; CI'sTest UIruns it.Acceptance notes
Measured on
e3bdc748(before) and this branch (after), the card's lane rebuilt locally: backendobjectstack dev --seed-admin --freshon examples/app-showcase, Consolevite buildwithVITE_BASE_PATH=/,vite previewproxying to it, Playwright Chromium, a fresh context per load, route/apps/showcase_app/page/showcase_project_workspace, headingNew Project + Tasks. Before and after were served side by side from twovite previews and alternated in blocks, 27 cold loads each, idle and with four CPU-bound processes on a 4-core box. Absolute times are readings on a shared box.Hop order (same in both builds): runtime/config + get-session + discovery, then me/localization, then me/permissions + organization reads + i18n +
meta/app+ preferences, then the bundle. Three serial API hops before the bundle request, before and after. The card's five-hop chain did not reproduce one3bdc748:me/appsandmeta/object?packageleave in the same wave as the bundle, not before it.What moved is the render gap inside that last hop:
meta/applands (ms)Heading-ready on an idle box did not move outside noise. A delay probe (1.5 s held on one request family, 3 loads each) puts the heading behind both the bundle and
meta/object?package(+1.0 to +1.5 s each), and not behindme/apps,meta/view, the approvals read, settings, agents or the inbox reads. The two critical reads leave within ~60 ms of each other and are answered by the server together, so on an idle box the bundle's earlier start buys about 40 ms of "both in hand". On the busy box the gain is larger because the render gap was larger.Not reproduced red: the 5 s heading budget held in every load measured here, before and after (worst 2745 ms before, 2687 ms after), so the card's second acceptance line (the busy-runner beforeEach wait) is not shown red-to-green locally; it is the Live E2E UI lane's to confirm.
What remains on the cold path is outside this card's surface: the gate between the session answer and the
meta/apprequest (sign-in locale, adapter connect and the route guards in the Console app), the server's time to answer the bundle and the package object list together, and the client render after both land (300 to 1000 ms on the busy box).Verification
Read first, by risk:
ui/packages/app-shell/src/console/appObjectScope.ts, the two effects added before the render-time bundle effect, and theenteredByListcheck in it: the de-duplication between the two entry points is the only place a second bundle request could come from.ui/packages/app-shell/src/console/__tests__/appObjectScope-12811.test.tsx, theobjectstack#38170describe at the end..changeset/38170-bundle-on-app-list.md.Two-minute check:
pnpm --dir ui exec vitest run packages/app-shell/src/console/__tests__/appObjectScope-12811.test.tsxfrom the repository root printsTests 28 passed (28).Local gates at 4f299c6: the derived set (38 of 38 run, exit codes captured before any pipe) plus the app-shell type-check and the narrowed suite
exit 0 ·
pnpm --filter @object-ui/app-shell type-checkexit 0 ·
pnpm exec vitest run (the 42 files that reach the changed hook)exit 0 ·
node scripts/check-adr-0087-registration.mjs --base origin/mainexit 0 ·
node scripts/check-adr-0087-registration.mjs --self-testexit 0 ·
node scripts/check-changeset-no-major.mjs --base origin/mainexit 0 ·
node scripts/check-closing-keyword-parity.mjsexit 0 ·
node scripts/check-closing-keyword-parity.mjs --self-testexit 0 ·
node scripts/check-comment-mask-corpus.mjsexit 0 ·
node scripts/check-empty-changeset.mjs --base origin/mainexit 0 ·
node scripts/check-empty-changeset.mjs --self-testexit 0 ·
node scripts/check-sdui-manifest.mjsexit 0 ·
node scripts/check-sdui-manifest.mjs --self-testexit 0 ·
node scripts/ci/snapshot-next.mjs --self-testexit 0 ·
node scripts/pm/check-governed-queue-guard.mjs --self-testexit 0 ·
node scripts/pm/release-rehearsal-clone.mjs --self-testexit 0 ·
node scripts/release-pending-publish.mjs --self-testexit 0 ·
pnpm --dir ui exec vitest run scripts/exit 0 ·
pnpm --filter @objectstack/spec run check:duration-unit-keysexit 0 ·
pnpm check:adr-anchorsexit 0 ·
pnpm check:changeset-gate-self-testsexit 0 ·
pnpm check:closed-ceremony-textexit 0 ·
pnpm check:cross-package-test-inputsexit 0 ·
pnpm check:dispatcher-error-vocabularyexit 0 ·
pnpm check:driver-memory-censusexit 0 ·
pnpm check:engine-double-contractexit 0 ·
pnpm check:gitlink-declaredexit 0 ·
pnpm check:nul-bytesexit 0 ·
pnpm check:published-filesexit 0 ·
pnpm check:query-options-erasureexit 0 ·
pnpm check:refd-timer-probeexit 0 ·
pnpm check:registry-log-declaredexit 0 ·
pnpm check:rest-log-spy-declaredexit 0 ·
pnpm check:skill-identifier-livenessexit 0 ·
pnpm check:test-source-aliasexit 0 ·
pnpm check:tier-file-adoptionexit 0 ·
pnpm check:type-check-coverageexit 0 ·
pnpm check:type-check-debtexit 0 ·
pnpm check:undeclared-dep-importsexit 0 ·
pnpm check:watch-hint-literalexit 0 ·
pnpm check:where-matchernode scripts/pm/dispatch-gates.mjs --ran: 38 derived families accounted for, 38 run, 0 NOT-MEASURED, 0 UNRUN.The app-shell
type-checkran after building its dependency closure (turbo run build --filter='@object-ui/app-shell^...', exit 0); bothtscprograms exit 0.pnpm exec eslinton the two changed sources: 0 errors; 3 moreno-explicit-anywarnings than base, from the test'sas anycasts on the adapter double, the shape the harness already uses.CI owns the rest:
Test UI(the full app-shell package),Lint UI,Type Check UI,Build & E2E UI,Live E2E UI.Human Minimum
packages/specholds no runtime logic.pnpm lintis CI's (Lint UI); eslint on the changed files reports 0 errors.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (Not touched.)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_017xRBcWDb7S8Z7oRDGzvfT2
Generated by Claude Code